home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
ASSEMBLE
/
2743.ZIP
/
WASH1
< prev
next >
Wrap
Text File
|
1980-01-01
|
4KB
|
126 lines
@OP
WASHING MACHINE (Version 1)
---------------------------
This program steps through a sequence to provide the
program for a typical washing machine.
The washing machine model is connected to real ports
436 (port A for outputs from CPU) and 437 (port B:
inputs to CPU). The input/output 8255 control register
is on port 439.
The model uses just eight bits for the address bus, so
cannot address those ports directly. By way of Debug
option L (level) in the model CPU program set model
ports 6, 7, 8, and 9 to 436, 437, etc, then use model
port 6 for port A, etc. Once set, these assignments are
saved to a configuration file which is loaded each time
the CPU program is executed, so only needs to be set
once.
The bit assignments on output port A are:
reverse=1, go=2, fast=4, water=8,
soap=16, drain=32, heat=64.
Bit assignments on input port B are:
start=1, dooropen=2, empty=4, full=8.
The assembler code to drive the washing machine might be:
label opcode operand(s) comment
----- ------ ---------- -------
; name and date
; constants
portA equ 6
portB equ 7
controlport equ 9
start equ 1
etc
Note: where one bit only is required in code, use label,
as with 'full' and 'empty' in subroutines waitfull
and waitempty.
Where more than one bit is required,
either define the combination
start&dooropen equ 3
then use start&dooropen in place of **
or put the bit combination in place of **
and supplement with comment as shown.
Flowcharts:
----------
Produce flowcharts for
1: main program
2: delay subroutine
3: waitfull subroutine
and 4: waitempty subroutine.
wash 1 - disk A26 - page 1 of 2
out controlport,131
; sets up 8255 i/o chip
start2 out portA,0 ; all outputs off
start3 in a, portB
and a, ** ; start + door open
cmp a, start ; door should be closed
jnz start3
out portA, ** ; water + soap + go
call waitfull
mov loopcount,3
loop out portA, ** ; go + rev + heat
call delay
out portA, go
call delay
dec loopcount
jnz loop
out portA, ** ; drain + go
call waitempty
out portA, ** ; water + go
call waitfull
out portA, ** ; drain + go
call waitempty
out portA, ** ; fast + go + drain
call delay
jmp start2
loopcount ds 1
delay mov a, 4
delay2 dec a
jne delay2
ret
waitfull in a,portB ; waits for drum to fill
and a,full
jz waitfull
ret
waitempty in a,portB ; waits for drum to empty
and a,empty
jz waitempty
ret
wash 1 - disk A26 - page 2 of 2